package com.qf.hospital.system.controller;

import com.qf.hospital.system.service.SysMenuService;
import com.qf.hospital.system.util.R;
import com.qf.hospital.system.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SysMenuController {

    @Autowired
    private SysMenuService sysMenuService;


    /**
     * 查询权限管理界面的左侧树结构的json
     * # path&method
     *     Request URL: http://localhost:8080/sel/loadMenuMangerLeftTreeJson
     *     Request Method: POST
     * # parameter
     * 	spread=1
     * # result
     * SUCCESS:
     * {
     *     "code": 0,
     *     "msg": "",
     *     "data": [
     *                {"id": 1,"title": "阿巴","parentId": 父节点id,"spread": false},
     *         {"id": 2,"title": "门诊管理","parentId": 1,"spread": false},
     *         {"id": 3,"title": "用户挂号","parentId": 2,"spread": false},
     *         ……
     *      ]
     * }
     */
    @PostMapping("/sel/loadMenuMangerLeftTreeJson")
    public ResultVO loadMenuMangerLeftTreeJson(Integer spread){
        //1. 返回数据
        return R.ok(sysMenuService.loadMenuMangerLeftTreeJson(spread));
    }

}
